$(function () {
    var url='../hotel/list'
    $("#jqGrid").Grid({
        url: url,
        datatype: "json",
        height: '400',
        mtype:'POST',
        // sortname:'id',
        colModel: [
			// {label: 'id', name: 'id',index: 'id',key: true},
            {label: '酒店名称', name: 'hotelName', index: 'hotelName'},
            {label: '酒店地址', name: 'address', index: 'address'},
			{label: '用户微信号', name: 'username', index: 'username'},
            {label: '用户名称', name: 'nickName', index: 'nickName'},
            {label: '用户手机号', name: 'mobile', index: 'mobile'},
            {
                label: '下单信息', width: 60, align: 'center', sortable: false, formatter: function (value, col, row) {
                    //console.log(row)
                    // var rowDate=JSON.stringify(row)
                    return `<button class="btn btn-outline btn-info btn-xs" onclick="vm.lookDetail(\'${row.username}\')"><i class="fa fa-search"></i>&nbsp;查看</button>`

                }
            }
        ]
    });
});

let vm = new Vue({
    el: '#rrapp',
    data: {

        q: {
            param:''

        },
    },
    methods: {
        query(){
            vm.reload()
        },
        reload: function (event) {
            var page = $("#jqGrid").jqGrid('getGridParam', 'page');
            $("#jqGrid").jqGrid('setGridParam', {
                postData: {'hotelName': vm.q.param},
                page: page
            }).trigger("reloadGrid");
            vm.handleReset('formValidate');
        },
        handleReset: function (name) {
            handleResetForm(this, name);
        },
        lookDetail: function (id) {
            console.log(id,'ass')
            //debugger
            // var str='<a href="javascript:;" class="active J_menuTab" data-id="shop/order.html">' +'所有管理'+'<i class="fa fa-times-circle"></i>'+
            //         '</a>'
            // 添加选项卡对应的iframe
            // var str1 = '<iframe class="J_iframe" name="iframe' + 20 + '" width="100%" height="100%" src="' + 'shop/order.html' + '" frameborder="0" data-id="' + 'shop/order.html' + '" seamless></iframe>';
            // $('.J_mainContent').find('iframe.J_iframe').hide().parents('.J_mainContent').append(str1);
            // $('.J_mainContent iframe:visible').load(function () {
            //     //iframe加载完成后隐藏loading提示
            //     layer.close(loading);
            // });
            // 添加选项卡
            // $('.J_menuTabs .page-tabs-content').append(str);
            // scrollToTab($('.J_menuTab.active'));
            //$('.J_menuTab .active').html(new_a)
            // $('.page-tabs-content').append(new_a)
            window.location.href='order.html?weChart='+id
            // $('.page-tabs-content .active').html('订单管理')
        }
    },
    created: function () {

    },


});